package edu.hcnu.mapper;

import edu.hcnu.entity.CarRecord;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @description:
 * @author: Administrator
 * @time: 2023/4/29 18:10
 */
@Mapper
public interface TickerMapper {


    @Select("select  count(cid) from t_car_record where cid=#{cid}")
    Integer queryHasBuy(String cid);

    @Select("select  seat from t_car where id=#{cid}")
    Integer querySeat(String cid);

    @Select("select * from t_car_record where uid=#{uid} and cid=#{cid}")
    CarRecord queryHasRecord(@Param("uid") String uid, @Param("cid") String cid);

    @Insert("insert into t_car_record(uid,cid) values (#{uid},#{cid})")
    boolean insertRecord(@Param("uid") String uid, @Param("cid") String cid);

    @Delete("delete from t_car_record where uid=#{uid} and cid=#{cid}")
    boolean deleteRecord(@Param("uid") String uid, @Param("cid") String cid);

    @Select("select * from t_car_record where uid=#{uid}")
    List<CarRecord> queryByUID(String uid);

    @Select("select * from t_car_record")
    List<CarRecord> getAllTicket();
}
